package com.ruoyi.web.controller.article;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.weixin.anno.RequireLogin;
import com.ruoyi.weixin.entity.R;
import com.ruoyi.weixin.entity.SgCategory;
import com.ruoyi.weixin.service.SgCategoryService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.io.Serializable;
import java.util.List;

/**
 * 分类表(SgCategory)表控制层
 *
 * @author makejava
 * @since 2024-01-22 17:44:25
 */
@RequireLogin
@RestController
@RequestMapping("/wexinLogin/sgCategory")
public class SgCategoryController {
    /**
     * 服务对象
     */
    @Resource
    private SgCategoryService sgCategoryService;

    @DataSource(value = DataSourceType.SLAVE)
    @GetMapping
    public R selectAll() {
        LambdaQueryWrapper<SgCategory> eq = new LambdaQueryWrapper<SgCategory>().eq(SgCategory::getPid, -1);
        return R.ok(sgCategoryService.list(eq));
    }


}

